package com.party.core.model.gatherInfo;

import com.google.common.collect.Maps;

import java.util.Map;

/**
 * 信息收集状态枚举
 *
 * @author yifeng
 * @date 2018/7/31 0031
 * @time 上午 9:47
 */
public enum GatherInfoMemberStatus {
    NOT_AUDIT_STATUS("1", "待审核"),

    PASS_STATUS("2", "审核通过"),

    REFUSE_STATUS("3", "审核拒绝");

    //状态码
    private String code;

    //状态值
    private String value;

    GatherInfoMemberStatus(String code, String value) {
        this.code = code;
        this.value = value;
    }

    /**
     * 根据状态码获取状态值
     *
     * @param code 状态码
     * @return 状态值
     */
    public static String getValue(String code) {
        for (GatherInfoMemberStatus signApplyStatus : GatherInfoMemberStatus.values()) {
            if (signApplyStatus.getCode().equals(code)) {
                return signApplyStatus.getValue();
            }
        }
        return null;
    }


    /**
     * 枚举类型转换为map
     *
     * @return 转换后的map
     */
    public static Map<String, String> convertMap() {
        Map<String, String> map = Maps.newHashMap();
        for (GatherInfoMemberStatus signApplyStatus : GatherInfoMemberStatus.values()) {
            map.put(signApplyStatus.getCode(), signApplyStatus.getValue());
        }
        return map;
    }


    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }
}
